package com.smasher.print.core;

import android.content.Context;

import org.json.JSONObject;

public class PrintHelper implements PrintDelegate {

    private PrintDelegate mPrintDelegate;

    public PrintHelper() {
    }

    public void setPrintDelegate(PrintDelegate printDelegate) {
        this.mPrintDelegate = printDelegate;
    }

    @Override
    public void printText(JSONObject json) {
        if (mPrintDelegate != null) {
            this.mPrintDelegate.printText(json);
        }
    }

    @Override
    public void connPrint(Context context) {
        if (mPrintDelegate != null) {
            this.mPrintDelegate.connPrint(context);
        }
    }

    @Override
    public void disConnPrint(Context context) {
        if (mPrintDelegate != null) {
            this.mPrintDelegate.disConnPrint(context);
        }
    }

    @Override
    public boolean isUnConnect(Context context) {
        return mPrintDelegate != null && mPrintDelegate.isUnConnect(context);
    }

    @Override
    public void release(Context context) {
        if (mPrintDelegate != null) {
            this.mPrintDelegate.release(context);
        }
    }
}
